package com.heima.behavior.controller.v1;

import com.heima.behavior.service.ApUserBehaviorService;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.behavior.dtos.UnLikesBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: Tangguo
 * @Date: 2023-06-23  15:42
 */
@RestController
@RequestMapping("/api/v1")
public class ApUserBehaviorController {
    @Autowired
    private ApUserBehaviorService apUserBehaviorService;

    /**
     * 用户点赞或取消点赞
     * @param dto:
     * @return ResponseResult
     */
    @PostMapping("/likes_behavior")
    public ResponseResult likeBehavior(@RequestBody LikesBehaviorDto dto) {
        return apUserBehaviorService.likeBehavior(dto);
    }


    /**
     * 用户阅读
     * @param dto:
     * @return ResponseResult
     */
    @PostMapping("/read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto dto) {
        return apUserBehaviorService.readBehavior(dto);
    }

    /**
     *  不喜欢
     * @param dto:
     * @return ResponseResult
     */
    @PostMapping("un_likes_behavior")
    public ResponseResult unLike(@RequestBody UnLikesBehaviorDto dto) {
        return apUserBehaviorService.unLike(dto);
    }
}
